package vn.com.tiz.DocumentZ.test;

import vn.com.tiz.DocumentZ.R;
import vn.com.tiz.DocumentZ.view.DocumentView;
import android.app.Activity;
import android.os.Bundle;
import android.view.Gravity;
import android.view.View;
import android.widget.Button;
import android.widget.FrameLayout;
import android.widget.LinearLayout;
import android.widget.TextView;

public class actTestZoom extends Activity {

	DocumentView page;
	TextView txvZoom;
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		setContentView(R.layout.test_zoom_view);
		
		FrameLayout container = (FrameLayout)findViewById(R.id.framContainer);
		
		
		txvZoom = (TextView)findViewById(R.id.txvZoomValue);
		
		
		page = new DocumentView(this);
		//container.addView(page);
		
		
		LinearLayout lnear = new LinearLayout(this);
		lnear.addView(page);
		lnear.setGravity(Gravity.CENTER);
		
		container.addView(lnear);
		//open
		
		Button btnZoomOut = (Button)findViewById(R.id.btnZoomOut);
		
		btnZoomOut.setOnClickListener(new View.OnClickListener() {
			
			public void onClick(View v) {
				// TODO Auto-generated method stub
				//page.setZoom(1.5f);
				page.setZoomBy(0.1f);
				
				txvZoom.setText(page.getCurrentZoom()*100+"%");
			}
		});
		
		Button btnZoomIn = (Button)findViewById(R.id.btnZoomIn);
		
		btnZoomIn.setOnClickListener(new View.OnClickListener() {
			
			public void onClick(View v) {
				// TODO Auto-generated method stub
				//page.setZoom(1.5f);
				page.setZoomBy(-0.1f);
				txvZoom.setText(page.getCurrentZoom()*100+"%");
			}
		});
	}
}
